<template>
  <!-- 项目状态 -->
  <a-select v-model="currentValue" v-bind="$attrs" :placeholder="placeholder" allow-clear v-on="$listeners">
    <a-select-option v-for="i in list" :key="i.id" :value="i.id">
      {{ i.name }}
    </a-select-option>
  </a-select>
</template>
<script>
export default {
  name: 'SelectorProjectStatus',
  props: {
    // v-model绑定的数据
    value: {
      type: [Array, String, Object, Number]
    },
    // placeholder
    placeholder: {
      type: String,
      default: function () {
        return '请选择项目状态'
      }
    }
  },
  data() {
    return {
      list: [
        {
          id: 1,
          name: '施工准备阶段'
        },
        {
          id: 2,
          name: '在建'
        },
        {
          id: 3,
          name: '停工'
        },
        {
          id: 4,
          name: '停缓建'
        },
        {
          id: 5,
          name: '维保期'
        },
        {
          id: 6,
          name: '维保期截止'
        }
      ]
    }
  },
  computed: {
    // 转换绑定的选中数据，与v-model同步
    currentValue: {
      get: function () {
        return this.value
      },
      set: function (value) {
        this.$emit('input', value)
      }
    }
  }
}
</script>
